const tabbarMenus = function () {
  return [
    /*{
      "pagePath": "/pages/delivery/index",
      "iconPath": "/images/tabbar/delivery.png",
      "selectedIconPath": "/images/tabbar/delivery_active.png",
      "hidden": true,
      "text": "工作"
    },*/
    {
      "pagePath": "/pages/index/index",
      "iconPath": "../../images/tabbar/index.png",
      "selectedIconPath": "../../images/tabbar/index_active.png",
      "text": "首页"
    },
    {
      "pagePath": "/pages/order/index",
      "iconPath": "../../images/tabbar/order.png",
      "selectedIconPath": "../../images/tabbar/order_active.png",
      "text": "订单"
    },
    {
      "pagePath": "/pages/member/index",
      "iconPath": "../../images/tabbar/my.png",
      "selectedIconPath": "../../images/tabbar/my_active.png",
      "text": "我的"
    }
  ]
}

function orderStatus() {

  return {
    0: "不限",
    1: "待付款",
    11: "待接单",
    12: "待出餐",
    16: "待分拣",
    17: "待配送",
    20: "已送达",
    60: "已退款",
    80: "已取消",
  };

}


//商家端
function ordderShopStatus() {

  return {
    11: "待接单",
    12: "待出餐",
    20: "已送达",
    60: "已退款",
    80: "已取消",
  }
}

function reasonList() {
  return [
    "不想要了/临时有事",
    "点错了/点多了/点少了",
    "地址/电话填错了",
    "送达时间选错了",
    "忘记写备注",
    "其他原因",
  ]
}

/**
 * 菜单类型
 */
function menuTypes() {
  return [
    {title: "不限", id: -1,},
    // {title: "普通", id: 0,},
    {title: "早餐", id: 1,},
    {title: "中餐", id: 2,},
    {title: "晚餐", id: 3,},
    {title: "中餐补餐", id: 4,},
    {title: "晚餐补餐", id: 5,},
  ];
  /*return {
    0: "不限",
   10: "普通",
    1: "早餐",
    2: "中餐",
    3: "晚餐",
    4: "中餐补餐",
    5: "晚餐补餐"
  };*/
}

function menuTypes_1() {
  return [
    // {title: "不限", id: -1,},
    {title: "普通", id: 0,},
    /* {title: "早餐", id: 1,},
     {title: "中餐", id: 2,},
     {title: "晚餐", id: 3,},
     {title: "中餐补餐", id: 4,},
     {title: "晚餐补餐", id: 5,},*/
  ];
}


/**
 * 菜单类型
 */
function deliverTimeRange() {
  return {
    /*3: "0:01-4:00",
    6: "4:01-8:00",
    9: "8:01-12:00",
    12: "12:01-16:00",
    15: "16:01-20:00",
    18: "20:01-0:00",*/
    0: "不限",
    2: '7:30-8:00',
    3: '8:30-9:00',
    4: '10:30-11:00',
    5: '11:30-12:00',
    7: "12:30-13:00",
    8: "13:30-14:00",
    9: "16:30-17:00",
    10: "17:30-18:00",
    11: "18:30-19:00",
    14: "19:30-20:00"
  }
}

function printerType(v = '') {
  var arr = {
    stall: "档口汇总单",
    label: "品单",
    order: "订单",
    keshi: "科室汇总单"
  }
  if (!v)
    return null;

  return arr[v] || v;
}

function getOrderCurrentStatus(order) {
  if (!order)
    return order;

  if (order.status == 61) { //部分退款
    order.current_status = 60;
    return order;
  } else if (order.status == 10) {
    if (order.delivery_status == 20) {//配送状态
      switch (parseInt(order.deliver_status)) {
        case 4:  //配送完成
          order.current_status = 20;
          break;
        case 3:  //配送中
          order.current_status = 17;
          break;
        case 2: //待配送
          order.current_status = 16;
          break;
        default:
          break;
      }
    } else if (order.delivery_status == 10) { //已接单->出餐中
      order.current_status = 12;
    } else {
      order.current_status = 11; //待接单
    }
  } else {
    order.current_status = order.status;
  }
  return order;
}

module.exports = {
  tabbarMenus: tabbarMenus,
  orderStatus: orderStatus,
  ordderShopStatus: ordderShopStatus,
  menuTypes: menuTypes,
  menuTypes_1: menuTypes_1,
  deliverTimeRange: deliverTimeRange,
  orderCurrentStatus: getOrderCurrentStatus,
  printerType: printerType,
  reasonList: reasonList
}